import { Injectable } from '@angular/core';
import {HttpService} from "@core/http/http.service";
import {BaseDictCommonVO, DictReversalVO, SNSResult, TrainStudent} from "@interface/index";
import {Observable} from "rxjs/Observable";
import * as API from "@api/index";
import {Response} from "@angular/http";

@Injectable()
export class TacticalService {

  constructor(
    private httpService: HttpService
  ) { }

  /**
   * @author 欧晓辉
   * @time 2018/3/9
   * @description 获取战术板运动类型
   */
  findSportType(lang = 'zh_CN'): Observable<SNSResult<DictReversalVO>> {
    const url = `${API.TRAIN_SPORT_TYPE}?lang=${lang}`;
    return this.httpService.get(url).map((res: Response) => res.json());
  }

  /**
   * @author 欧晓辉
   * @time 2018/3/9
   * @description 根据战术类型获取战术名称列表
   * @param sportType 运动类型码
   * @param orgUserId 组织id
   */
  findSportTypeList(sportType: string, orgUserId: string): Observable<SNSResult<any>> {
    const url = `${API.TRAIN_SPORT_TYPE_LIST}?sportType=${sportType}&orgUserId=${orgUserId}`;
    return this.httpService.get(url).map((res: Response) => res.json());
  }
}
